print("欢迎来到取款机")
name = input("请输入你的得名称")
money = 5000000


def menu():
    while 1 == 1:
        print(f"你好{name}欢迎进入ATM自助取款机")
        print("请输入你要接下来得操作")
        print("1.查询余额")
        print("2.存款")
        print("3.取款")
        print("4.退出")
        num1 = int(input("请输入你的选择"))
        if num1 == 1:
            check_amount()
        elif num1 == 2:
            save_money()
        elif num1 == 3:
            take_money()
        elif num1 == 4:
            print("欢迎你下次光临")
            break
        else:
            print("输入错误，程旭退出")
            break


def check_amount():
    print(f"你好{name},你的余额是{money}")


def save_money():
    amount = int(input("请输入你要存钱的数量"))
    global money
    money = money + amount
    print(f"恭喜你，存入{amount}元成功")
    print(f"你的余额是{money}元")


def take_money():
    amount = int(input("请输入你要取钱的数量"))
    global money
    money = money - amount
    print(f"恭喜你，取出{amount}元成功")
    print(f"你的余额是{money}元")


menu()
